﻿@model System.Web.Security.MembershipUser
@{
    ViewBag.Title = "Edit User";
}
<h2>@ViewBag.Title</h2>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>User Details</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.UserName)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.UserName)
            @Html.HiddenFor(model => model.UserName)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.IsApproved)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.IsApproved)
            @Html.ValidationMessageFor(model => model.IsApproved)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CreationDate)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.CreationDate)
        </div>
        <div class="editor-label">
            @Html.LabelFor(model => model.LastActivityDate)
        </div>
        <div class="editor-field">
            @Html.DisplayFor(model => model.LastActivityDate)
        </div>
    </fieldset>

    <fieldset>
        <legend>Roles</legend>
        <ul>
            @foreach (string role in (string[])Roles.GetAllRoles())
            {
                <li>@Html.CheckBox("role." + role, Roles.IsUserInRole(Model.UserName, role))
                    <label>@role</label>
                </li>
            }
        </ul>
    </fieldset>
    
    <p>
        <input type="submit" value="Save" />
    </p>
}
<div>
    @Html.ActionLink("Back to List", "Index", "Users")
</div>
